package com.example.demo.controller;

import com.example.demo.model.ListConfig;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
@Controller
public class UserController {

    @Value("${server.port}")
    private String port;

    @Autowired
    private Student student;

    @Resource
    private ListConfig config;

    // 设置路由地址，尽量全部小写
    // 由于返回的是一个非静态页面的数据，因此需要再加上@ResponseBody的注释
    @ResponseBody
    @RequestMapping("/sayhi")
    public String sayHi() {
        return "config: " + config.getName();
    }
}
